package ca.camosun.proximity;

import java.util.List;


import android.os.Vibrator;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.widget.LinearLayout;
import android.widget.TextView;
import ca.camosun.proximity.Room;
import ca.camosun.proximity.AlertVibrate;

public class RoomController {

	private Person target;
	private DeviceTracker keep;
	private DeviceTracker avoid;
	private AlertVibrate warning;
	
	public RoomController(Person intarget) {
		target = intarget;
		keep = Room.getInstance().getPeopleToKeepClose();
		avoid = Room.getInstance().getPeopleToKeepAway();
		warning = new AlertVibrate(warning);
	}	
	
	//scan for targets devices
	
	public void determineTarget() {
		if (keep.contains(target)) {
			keepTheTarget();
		}
		
		if (avoid.contains(target)) {
			avoidTheTarget();
		}
	}
	
	public void keepTheTarget() {		
		
		if (target.getMyDevices().isEmpty()) {
			warning.targetLeft(target);
		}
		
	}
	
	public void avoidTheTarget() {
		
		if (target.getMyDevices().isEmpty()) {
			warning.targetEnter(target);
		}
	}

}
